﻿Public Class frmClaimsBatchUpdate

    Private Sub frmClaimsBatchUpdate_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'setup datasources
        '
        'AppliesTo
        '
        Dim sql = <sql>
                        select 1 as id, 'ΚΑΤΑΠΙΣΤΕΥΜΑ' as Description
                        union
                        select 2 as id, 'ΕΤΑΙΡΙΑ' as Description
                        union
                        select 3 as id, 'ΚΑΙ ΤΑ ΔΥΟ' as Description
                    </sql>
        Me.AppliesTo.DataSource = Model.ModelContext.CurrentDBUtils.getDataTable(sql.Value)
        Me.AppliesTo.DisplayMember = "Description"
        Me.AppliesTo.ValueMember = "id"
    End Sub


    Private Sub cmdUpdate_Click(ByVal sender As System.Object, _
                                ByVal e As System.EventArgs) Handles cmdUpdate.Click

        Me.ErrorProvider.Clear()

        If Me.Percentage.Text = String.Empty OrElse _
                    IsNumeric(Me.Percentage.Text) = False OrElse _
                    CDec(Me.Percentage.Text) < 0 OrElse _
                    CDec(Me.Percentage.Text) > 99.99 Then

            Me.ErrorProvider.SetError(Me.Percentage, "Invalid Percentage. Must be a number between 0 and 99.99")

        End If

        If Me.ErrorProvider.GetError(Me.Percentage) = String.Empty Then
            If winUtils.MsgboxQuestion("Apply to Claims Using percentage {0} ? ", _
                                       CDec(Me.Percentage.Text)) = MsgBoxResult.Yes Then

                Me.DialogResult = Windows.Forms.DialogResult.OK
            End If
        End If

    End Sub

    Private Sub cmdCancel_Click(sender As System.Object, e As System.EventArgs) Handles cmdCancel.Click
        Me.DialogResult = Windows.Forms.DialogResult.Cancel
    End Sub

  
End Class